Android DeskClock源码分析之旅---AndroidManifest.xml文件

本文分析了Android系统应用DeskClock的AndroidManifest.xml文件,详细探讨了各个Activity、Activity-Alias、Service、Receiver和Provider的配置,包括它们的功能、标签和属性设置。通过对AlarmActivity、ScreensaverActivity等组件的解析,揭示了DeskClock如何实现其主要功能,如闹钟、设置和屏幕保护。此外,还提到了一些特定属性如android:excludeFromRecents和android:showOnLockScreen的作用。
摘要由CSDN通过智能技术生成

需要仿照ios时钟界面,android系统中实现,首先分析android系统应用DeskClock

分析方法,首先分析AndroidManifest文件

分析AosDeskClock AndroidManifest.xml文件

    <application android:label="@string/app_label"
                 android:icon="@mipmap/ic_launcher_alarmclock"
                 android:requiredForAllUsers="true"
                 android:supportsRtl="true">
application层级 设置了label icon supportsRtl  
以及                 android:requiredForAllUsers="true"------此句意义不明确  
               

        <activity android:name="DeskClock"
                android:label="@string/app_label"
                android:theme="@style/DeskClock"
                android:icon="@mipmap/ic_launcher_alarmclock"
                android:launchMode="singleTask"
                android:screenOrientation="portrait"
                android:windowSoftInputMode="adjustNothing"
                >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
第一个activity name DeskClock 桌面时钟,与整个application有相同的label,theme 主题风格,应该是设置字体颜色等,icon图标,activity的launchmode singletask,screenOrientation,竖直方向,windowsoftinputmode,此属性用来协调虚拟键盘弹出的显示情况,此属性有待研究
还适配了一个intent-filter action category已经给出,应该是用于外部启动这个activity


        <activity-alias android:name="DockClock"
                android:targetActivity="DeskClock"
                android:label="@string/app_label"
                android:theme="@style/DeskClock"
                android:icon="@mipmap/ic_launcher_alarmclock"
                android:launchMode="singleTask"
                android:enabled="@bool/config_dockAppEnabled"
                >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.DESK_DOCK" />
            </intent-filter>
        </activity-alias>
一个activity-alias层级 activity-alias通过指定targetActivity来决定入口相连接的activity,给该程序更改一个不同的label和icon,两个图标进入同一个activity


         <activity android:name="SettingsActivity"
                android:label="@string/settings"
                android:theme="@style/Theme.Settings"
                android:taskAffinity=""
                android:excludeFromRecents="true"
                >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
第二个activity name SettingsActivity 有一个label,theme,taskAffinity空, android:excludeFromRecents控制在不在recent列表中显示。true时不显示;false显示,默认。运行如下activity后,不会显示在recent列表中。依然有意个intent-filter

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值